//
//  HMNetwork.swift
//  HMWeibo1
//
//  Created by liGordon on 16/4/9.
//  Copyright © 2016年 lifuli. All rights reserved.
//

import UIKit

import AFNetworking



enum HMNetworkErrorEnum: Int {
    case AccessTokenEmpty = -1
    case UidEmpty = -2
    
    var errorDescription: String {
        get {
            switch self {
            case AccessTokenEmpty: return "access_token没有值"
            case UidEmpty: return "uid没有值"
            }
        }
    }
    
    // 返回一个错误
    func error() -> NSError {
        return NSError(domain: "cn.itheima.net", code: self.rawValue, userInfo: ["errorDescrption" : self.errorDescription])
    }
}

class HMNetwork: AFHTTPSessionManager {
    

    
    static let shareInstance: HMNetwork = {
        let tool = HMNetwork()
        
        ///  set元素是无序的 元素不会重复
       tool.responseSerializer.acceptableContentTypes?.insert("text/plain"
        )
        
        return tool
     }()

}
